<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.js"></script>

</head>
<body>
<button id="btn">获取数据</button>
<div id="container"></div>
<script>
    var button = document.querySelector('#btn')
    var div = document.querySelector('#container')
    button.onclick = () => {
        axios({
            method: 'GET',
            url:'hello/findAllStudents'
        }).then(res => {
            result = res.data
            result.forEach(item => {
                div.innerHTML +=  "<tr>\n" +
                    "<td>" + item.name + "</td>\n\n" +
                    "<td>" + item.major + "</td><br>" +
                    "</tr>"
            });
        })
    }
</script>
</body>
</html>
